package com.appspot.niehonglei.jdo;

import java.io.Serializable;
import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.appspot.niehonglei.common.Tools;
import com.google.appengine.api.datastore.Text;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Index implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent
	private String title;

	@Persistent
	private String category;

	@Persistent
	private String comeFrom;

	@Persistent
	private String author;

	@Persistent(serialized = "true", defaultFetchGroup = "true")
	private Text content;
	
	@Persistent
	private Long clickRate;

	@Persistent
	private Date createDate;

	@Persistent
	private Date changeDate;

	@Persistent
	private Long removed;//0正常显示；1热门文章；2草稿；

	public Index(Text content) {
		this.content = content;
		this.category = "生活";
		this.comeFrom = "http://niehonglei.appspot.com";
		this.author = "nehnre";
		this.createDate = Tools.shiftDate(new Date());
		this.changeDate = Tools.shiftDate(new Date());
		this.removed = Long.valueOf(0);
		this.title = Tools.date2str(Tools.shiftDate(new Date()));
		this.clickRate = Long.valueOf(0);
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Text getContent() {
		return content;
	}

	public void setContent(Text content) {
		this.content = content;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getChangeDate() {
		return changeDate;
	}

	public void setChangeDate(Date changeDate) {
		this.changeDate = changeDate;
	}

	public Long getRemoved() {
		return removed;
	}

	public void setRemoved(Long removed) {
		this.removed = removed;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getComeFrom() {
		return comeFrom;
	}

	public void setComeFrom(String comeFrom) {
		this.comeFrom = comeFrom;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Long getClickRate() {
		return clickRate;
	}

	public void setClickRate(Long clickRate) {
		this.clickRate = clickRate;
	}

	public static void main(String args[]){
		StringBuffer sb = new StringBuffer("dd");
		sb.append("");
		System.out.println(sb.toString());
	}
}
